//
//  XUIGlobalProgressView.m
//  etionUI
//
//  Created by wu jingxing on 12-8-26.
//  Copyright (c) 2012年 GuangZhouXuanWu. All rights reserved.
//

#import "XUIGlobalProgressView.h"

@implementation XUIGlobalProgressViewPanelHelper

static XUIGlobalProgressViewPanelHelper* g_globlepvp;

+(void)initWithActivity:(BOOL)bActivity title:(NSString*)szTitle text:(NSString*)szText
{
    if(g_globlepvp==nil)
        g_globlepvp=[XUIGlobalProgressViewPanelHelper new];
    [g_globlepvp progressViewPanelHelperWithActivity:bActivity title:szTitle text:szText delegate:g_globlepvp];
}

+(void)release
{
    [g_globlepvp releaseProgressViewPanel];
}

+(void)initWithActivity:(BOOL)bActivity title:(NSString*)szTitle text:(NSString*)szText delayReleaseTime:(NSTimeInterval)nTime
{
    if(g_globlepvp==nil)
        g_globlepvp=[XUIGlobalProgressViewPanelHelper new];
    [g_globlepvp progressViewPanelHelperWithActivity:bActivity title:szTitle text:szText delegate:g_globlepvp];
    g_globlepvp.delayReleaseTime=nTime;
    [g_globlepvp releaseProgressViewPanel];
}

+(void)initWithTitle:(NSString*)szTitle
{
    [XUIGlobalProgressViewPanelHelper initWithActivity:NO title:szTitle text:nil delayReleaseTime:1.5];
}

-(id)init
{
    self = [super init];
    return self;
}

-(void)touchProgressViewPanel:(CProgressViewPanel *)pvp
{
    
}

-(UIView*)getProgressViewPanelParent:(CProgressViewPanel *)pvp
{
    return [[UIApplication sharedApplication].delegate window];
}

-(CGRect)getProgressViewPanelCoverRect:(CProgressViewPanel *)pvp
{
    return [[UIApplication sharedApplication].delegate window].bounds;
}

-(CGPoint)getProgressViewCenterPosition:(CProgressViewPanel *)pvp
{
    CGSize size = [self getProgressViewPanelCoverRect:pvp].size;
    return CGPointMake(size.width / 2, size.height / 2);
}

-(void)progressViewPanelDidRemove:(CProgressViewPanel *)pvp
{
    ReleaseObj(g_globlepvp);
}


@end
